package com.ctsi.event.app.config;

import com.ctsi.commons.event.EventPublisherMan;
import com.ctsi.commons.event.man.EventMan;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Scope;

/**
 * @author: zhangjw
 * @Date: 2018/11/6 10:38
 * @Description: 事件配置类
 */
@Configuration
public class CloudEventAutoConfig {


    /**
     * 事件发布bean
     * @return
     */
    @Bean("eventPublisher")
    @Primary
    @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
    public EventPublisherMan eventPublisherMan(){
        return EventPublisherMan.getEventPublisherMan();
    }

    /**
     * 事件管理
     * @return
     */
    @Bean("eventManager")
    @Primary
    @Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
    public EventMan eventManager(){
        return new EventMan();
    }


}
